//
//  MerchantDgVC.m
//  XY
//
//  Created by 洛水寒 on 16/5/11.
//  Copyright © 2016年 洛水寒. All rights reserved.
//

#import "MerchantDgVC.h"
#import "GPDateView.h"
#import "CaptchaView.h"
#define Key_DistrictSelectProvince          @"DistrictSelectProvince"
#define Key_DistrictSelectProvinceCode      @"DistrictSelectProvinceCode"
#define Key_DistrictSelectProvinceSubCode   @"DistrictSelectProvinceSubCode"
#define Key_DistrictSelectProvinceSub       @"DistrictSelectProvinceSub"
#define Key_DistrictSelectCityCode          @"DistrictSelectCityCode"
#define Key_DistrictSelectCity              @"DistrictSelectCity"
@interface MerchantDgVC ()<UITextFieldDelegate>
{
    CaptchaView *authCodeView;
}
@property (weak, nonatomic) IBOutlet UITextField *siteTF;
@property (weak, nonatomic) IBOutlet UITextField *detailSiteTF;
@property (weak, nonatomic) IBOutlet UITextField *nameTF;
@property (weak, nonatomic) IBOutlet UITextField *phoneTF;
@property (weak, nonatomic) IBOutlet UITextField *codeTF;
@property (weak, nonatomic) IBOutlet UIButton *sBtn;

@end

@implementation MerchantDgVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.title = @"商户申请";
    self.edgesForExtendedLayout = UIRectEdgeNone;//跳过64
    self.view.backgroundColor = [UIColor whiteColor];
    UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:nil action:nil];//去掉返回的字
    self.navigationItem.backBarButtonItem = item;
    
    //显示验证码界面
    authCodeView = [[CaptchaView alloc] initWithFrame:CGRectMake(0, 0, _sBtn.bounds.size.width, _sBtn.bounds.size.height)];
    [_sBtn addSubview:authCodeView];
    
    
    _siteTF.enabled = YES;
    
    _siteTF.delegate =self;
   _detailSiteTF.delegate =self;
    _nameTF.delegate =self;
    _phoneTF.delegate =self;
  
    _codeTF.delegate =self;
}

//选择收货地址
- (IBAction)chooseSiteBtn:(id)sender
{
    GPDateView * dateView = [[GPDateView alloc] initWithFrame:CGRectMake(0, HEIGHT-250, WEITH, 250) Data:nil];
    
    [dateView showPickerView];
    
    dateView.ActionDistrictViewSelectBlock = ^(NSString *desStr,NSDictionary *selectDistrictDict){
  
        _siteTF.text = [NSString stringWithFormat:@"%@%@%@",[selectDistrictDict objectForKey:Key_DistrictSelectProvince],[selectDistrictDict objectForKey:Key_DistrictSelectCity],[selectDistrictDict objectForKey:Key_DistrictSelectProvinceSub]];
    };
}


//获取验证码
- (IBAction)obtainCard:(id)sender {
    
    
}
//注册
- (IBAction)registerBtn:(id)sender {
}




#pragma mark --去键盘

- (void)_handleEndEditing
{
    [self.view endEditing:YES];
}

//当用户按下return去键盘

- (BOOL)textFieldShouldReturn:(UITextField *)textField

{
    
    
    [textField resignFirstResponder];
    
    
    return YES;
    
}

//空白去键盘

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event

{
    
    [self.view.window endEditing:YES];
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
